var express = require('express');
var router = express.Router();

const data = []

/* GET build page. */
router.get('/', function(req, res, next) {
  res.render('build', { title: '楼宇管理', list: data });
});

/** POST 新增一条记录 */
router.post('/', function (req, res, next) {
  const newRecord  = Object.assign({id:data.length+1}, req.body)
  data.push(newRecord)
  res.json({
    code: 0,
    message: '操作成功！',
    data: newRecord
  })
})

module.exports = router;
